home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / initsemaphore.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  74 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: initsemaphore.c,v 1.4 1996/08/13 13:56:03 digulla Exp $
  4.     $Log: initsemaphore.c,v $
  5.     Revision 1.4  1996/08/13 13:56:03  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:12  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include "exec_intern.h"
  17.  
  18. /*****************************************************************************
  19.  
  20.     NAME */
  21.     #include <exec/semaphores.h>
  22.     #include <clib/exec_protos.h>
  23.  
  24.     __AROS_LH1I(void, InitSemaphore,
  25.  
  26. /*  SYNOPSIS */
  27.     __AROS_LHA(struct SignalSemaphore *, sigSem, A0),
  28.  
  29. /*  LOCATION */
  30.     struct ExecBase *, SysBase, 93, Exec)
  31.  
  32. /*  FUNCTION
  33.     Prepares a semaphore structure for use by the exec semaphore system,
  34.     i.e. this function must be called after allocating the semaphore and
  35.     before using it or the semaphore functions will fail.
  36.  
  37.     INPUTS
  38.     sigSem - Pointer to semaphore structure
  39.  
  40.     RESULT
  41.  
  42.     NOTES
  43.     Semaphores are shared between the tasks that use them and must
  44.     therefore lie in public (or at least shared) memory.
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.  
  52.     INTERNALS
  53.  
  54.     HISTORY
  55.     29-10-95    digulla automatically created from
  56.                 exec_lib.fd and clib/exec_protos.h
  57.     21-01-96    fleischer implementation
  58.  
  59. *****************************************************************************/
  60. {
  61.     __AROS_FUNC_INIT
  62.  
  63.     /* Clear list of wait messages */
  64.     sigSem->ss_WaitQueue.mlh_Head    =(struct MinNode *)&sigSem->ss_WaitQueue.mlh_Tail;
  65.     sigSem->ss_WaitQueue.mlh_Tail    =NULL;
  66.     sigSem->ss_WaitQueue.mlh_TailPred=(struct MinNode *)&sigSem->ss_WaitQueue.mlh_Head;
  67.  
  68.     /* Semaphore is currently unused */
  69.     sigSem->ss_NestCount=0;
  70.  
  71.     __AROS_FUNC_EXIT
  72. } /* InitSemaphore */
  73.  
  74.